<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Maintenance</title>
    <meta charset="utf-8">
    <?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
    <link rel="stylesheet" type="text/css" media="screen" href="http://localhost/cms_edu/Template/qiye/css/reset.css">
    <link rel="stylesheet" type="text/css" media="screen" href="http://localhost/cms_edu/Template/qiye/css/style.css">
     <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700,300' rel='stylesheet' type='text/css'>
    <script src="http://localhost/cms_edu/Template/qiye/js/jquery-1.7.min.js"></script>
    <script src="http://localhost/cms_edu/Template/qiye/js/jquery.easing.1.3.js"></script>
</head>
<body>
<div class="bg">
   <header>
       <div class="main wrap">
       		<h1><a href="http://localhost/cms_edu"><img src="http://localhost/cms_edu/Template/qiye/images/logo.png" alt="公司logo"></a></h1> 
            <p>8901 Marmora, Glasgow <span>8 (010) 123 4567</span></p>
       </div>
       <nav>
          <ul class="menu">
              <li class="current"><a href="http://localhost/cms_edu" class="home"><img src="http://localhost/cms_edu/Template/qiye/images/home.jpg" alt=""></a></li>
			<?php
	$topCate = K('Category')->where("pid=0")->limit(1000)->all();
	foreach($topCate as $field):
	$field['url'] = getCateUrl($field['is_listhtml'],$field['htmldir'],$field['cid']);
?>
	
              <li><a href="<?php echo $field['url'];?>"><?php echo $field['cname'];?></a></li>
			
<?php
	endforeach;
?>
          </ul>
          <div class="clear"></div>
      </nav>
   </header>
   <!--==============================content================================-->
   <section id="content"><div class="ic"></div>
      <div class="sub-page">
      	<div class="sub-page-left">
        	<h2 class="p4"><?php
	$cate = K('Category')->where("cid=22")->limit(1)->all();
	foreach($cate as $field):
	$field['url'] = getCateUrl($field['is_listhtml'],$field['htmldir'],$field['cid']);
?>
	<?php echo $field['cname'];?>
<?php
	endforeach;
?> 信息</h2>
        	<?php
	//如果有此参数，就是要实现分页效果
	if(4){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->count();
		$pageObj = new Page($total,4,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit(1000)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_archtml'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>

            <div class="box-6 top-2">
            	<img src="<?php echo $field['thumb'];?>" alt="文章图片" class="img-indent-2" style="width: 270px;height: 186px;">
                <div class="extra-wrap">
                	<a style="display: block;" href="<?php echo $field['url'];?>" class="text-2"><?php echo $field['title'];?></a>
                    <span>发表时间:<?php echo date('m-d H:i:s',$field['sendtime']);?></span>
                    <p class="upper"><?php echo $field['digest'];?></p>
                </div>
            </div>
           
<?php
	endforeach
?>
        </div>
      <?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<div class="sub-page-right">
	<div class="shadow box-7 bot-2">
	    <h2 class="p2">最新文章</h2>
	    <?php
	//如果有此参数，就是要实现分页效果
	if(0){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->count();
		$pageObj = new Page($total,0,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit(2)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_archtml'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>

		    <p class="text-3 p2"><?php echo $field['title'];?></p>
		    <p class="upper"><?php echo $field['attr'];?>  <span>发表时间:<?php echo date('m-d H:i:s',$field['sendtime']);?></span></p>
		    <img src="<?php echo $field['thumb'];?>" alt="文章图片" style="width: 190px;height: 120px;">
		    <a href="<?php echo $field['url'];?>" class="button-2 top-3">Read More</a>
		    <p class="text-3 p2"> </p>
		
<?php
	endforeach
?>
	</div>
</div>
      </div>  
   </section> 
  <!--==============================footer=================================-->
     <?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
    <footer>1234567890&<a href="" target="_blank">版权</a>
    </footer>	
</div> 
</body>
</html>
